package com.yuzhihao.writejvm.attributes.stack;

import com.yuzhihao.writejvm.clazz.ClassInfo;
import com.yuzhihao.writejvm.format.PrintFormat;
import com.yuzhihao.writejvm.format.StackMapFrameEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.log4j.Log4j2;

import java.io.DataInputStream;

/**
 * 0-63
 * @see  <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.4">jvmdoc</a>
 * @author yzh
 * @since 2021年12月14日13:32:39
 */
@Data
@Log4j2
@EqualsAndHashCode(callSuper = true)
public class SameFrame extends StackMapFrame{

    public SameFrame() {
        super();
        super.setSmfe(StackMapFrameEnum.same_frame);
    }

    @Override
    public void parse(DataInputStream dis, ClassInfo ci) {
        super.setCi(ci);
    }

    @Override
    public String print(String print) {
        return print+PrintFormat.EMPTY+"frame_type"+ PrintFormat.EQUAL+super.frame_type + PrintFormat.EMPTY+"/* same_frame */" +System.lineSeparator();
    }
}
